package com.example.androidtool.edittext;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.EditText;

import com.example.androidtool.R;
import com.google.android.material.textfield.TextInputLayout;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class EditTextActivity extends AppCompatActivity {
    TextInputLayout tl_username, tl_password;
    EditText et_username, et_password;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit_text);
        tl_username = findViewById(R.id.tl_username);
        tl_password = findViewById(R.id.tl_password);
        et_username = findViewById(R.id.et_username);
        et_password = findViewById(R.id.et_password);


    }

    private final String EMALL_PATTERN  = "^[a-zA-Z0-9#_！￥&'()*+,;=:.\"(),:;<>@\\[\\]\\\\]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*$";

    private Pattern pattern = Pattern.compile(EMALL_PATTERN);
    private boolean ValidateUserName(String username){
        Matcher matcher = pattern.matcher(username);
        return matcher.matches();
    }


    private boolean validatePassword(String password) {
        return password.length() > 6;
    }


}